package test;

import java.io.File;

/**
 * Created by Administrator on 2016/11/21 0021.
 */
public class DeleteFile {

    public static void main(String[] args){
        File file = new File("D:\\text.txt");  // 输入要删除的文件位置
        String fileName = file.getName();
        if (file.exists() && file.isFile()) {
            if (file.delete()) {
                System.out.println("删除单个文件" + fileName + "成功！");
            } else {
                System.out.println("删除单个文件" + fileName + "失败！");
            }
        } else {
            System.out.println("删除单个文件失败：" + fileName + "不存在！");
        }
    }
}
